<!--结算单详情-->
<template>
  <div class="contain">
    <div class="order-detail-top">
      <ul class="order-detail-info">        
        <li class="displayflex">
          <label>结算单号</label>
          <p class="flex1">{{todolist.SettleBillNo}}</p>
        </li>
        <li class="displayflex">
          <label>已选金额</label>
          <p class="flex1">{{selectAmount}}元</p>
        </li>
      </ul>      
    </div>
    
    <div class="order-detail-header">
      <span class="f-l">填写发票</span>
    </div>  
    <div class="m-form-wrap">
      <div class="m-form-box">
        <span class="txt">发票号</span>
        <div class="m-form-ipt">
          <input type="text" v-model="InvoiceNo">
        </div>
      </div>
      <div class="m-form-box">
        <span class="txt">发票金额</span>
        <div class="m-form-ipt">
          <input type="text" v-model="InvoiceAmount">
        </div>
      </div>
    </div>

    <!--footer-->
    <div class="checknum-bot displayflex">
      <div class="flex1">
        <ul class="cf cn-btn-grp f-r">
          <li class="btn-checknum f-l cancel" @click="cancel">取消</li>
          <li class="btn-checknum f-l" @click="confirm()">确认</li>
        </ul>
      </div>
    </div>
    <!--footer-->
  </div>
</template>

<script>

export default {
  name:'statementConfirm',
  data() {
    return {
      todolist: [],
      tododetail: [],
      selectAmount: 0,
      InvoiceNo: '',
      InvoiceAmount: 0,
    }
  },
  created(){
    
  },
  mounted() {
    this.$nextTick(function() {
      this.getData();
    })
  },
  methods: {
    getData: function() {
      this.todolist = JSON.parse(sessionStorage.items);
      this.tododetail = JSON.parse(sessionStorage.Selectitems);
      this.selectAmount = JSON.parse(sessionStorage.Amount);
    },
    cancel(){
      this.$router.push({
        path: '/order/statementList'
      });
    },
    confirm: function() {
      var self = this;
      if (!this.InvoiceNo) {
          this.Toast('请输入发票号！');
          return false;
      };
      if (!this.InvoiceAmount || this.InvoiceAmount == 0) {
          this.Toast('请输入发票金额！');
          return false;
      };
      var query = {
          GUID: this.todolist.Guid,
          InovicedAmount: this.InvoiceAmount,
          InvoiceNo: this.InvoiceNo,
          trsettlemv: this.tododetail,
      };
      this.Ajax.post('EditInoviced',query).then(function(resp){
        if (resp.IsSuccess) {
          self.MessageBox.alert('录入成功').then(action => {
            self.$router.push({
              path: '/order/statementList'
            });
          });
        }
      });
    }
  }
}
</script>